home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-28 | 5.6 KB | 152 lines | [TEXT/CWIE] |
- /* This file is part of the Internet Configuration system and is placed in the public domain for the benefit of all.
-
- This file holds all those miscellaneous little functions that are basically wrappers
- around existing OS functionality.
- */
-
- #import <Lists.h>
- #import <AppleEvents.h>
-
- /* ***** QuickDraw Stuff ***** */
-
- extern pascal void DrawIcon(SInt16 resourceID, const Rect iconRect, Boolean drawHighlighted);
- /* This routine draws in icon from the resources specified by resourceID.
- If the System 7 icon utilities are available, it uses the icon family
- resources 'icl8', and draws using the icon utilities. If they're not available,
- it uses the 'ICN#' resource and draws using PlotIcon.
- */
-
- extern pascal void MagicMarkerMode(void);
- /* This routine sets the HiliteMode low memory global such that the
- next invert operation is done using the user specified highlight colour.
- If Colour QuickDraw isn't available, it does nothing.
- */
-
- /* ***** Event Manager Stuff ***** */
-
- extern pascal Boolean DirtyKey(char typedChar);
- /* This function returns true if the given character will cause a Text
- Edit field to become dirty, ie it's a character that will go into
- the field rather than move the insertion point.
- */
-
- extern pascal Boolean IsKeyDown(SInt16 keyCode);
- /* Returns true if the given virtual key is down. */
-
- /* ***** Window Manager Stuff ***** */
-
- /* EnterWindow, ExitWindow and the SavedWindowState type are used to implement
- a standard mechanism for saving and restoring window information. You call
- EnterWindow when you want to work on a window. This sets up the parameters
- you need and saves the old parameters in the SavedWindowState variable.
- You then call ExitWindow to restore that state.
- */
-
- struct SavedWindowInfo {
- GrafPtr oldPort;
- GrafPtr thisPort;
- SInt16 font;
- SInt16 size;
- SInt16 face;
- };
- typedef struct SavedWindowInfo SavedWindowInfo;
-
- extern pascal void EnterWindow(WindowPtr window, SInt16 font, SInt16 size, Style face,
- SavedWindowInfo *saved);
- /* Set thePort to window and establish the various window state parameters.
- Save the old parameters in saved.
- */
-
- extern pascal void ExitWindow(const SavedWindowInfo saved);
- /* Recover the window parameters from saved. */
-
- extern pascal RgnHandle GetWindowContentRegion(WindowPtr theWindow);
- /* Returns the window's content region. This is the region currently
- being used, not a copy. Do not munge it!
- */
-
- extern pascal RgnHandle GetWindowStructureRegion(WindowPtr theWindow);
- /* Returns the window's structure region. This is the region currently
- being used, not a copy. Do not munge it!
- */
-
- extern pascal Boolean TitleBarOnScreen(WindowPtr theWindow);
- /* Returns true if the window's title bar is on the screen.
- Note that this routine only works if the window is visible,
- ie you have called ShowWindow on it. The standard mechanism
- for using this routine is to ShowWindow the window, then
- call TitleBarOnScreen. If it returns true, everything is cool.
- Otherwise the window is completely off the screen, so you can
- move it back on without causing visible effects.
- */
-
- extern pascal void GetWindowRect(WindowPtr theWindow, Rect *windowRect);
- /* This routine sets windowRect to the global co-ordinates of
- the position of the window. It's typically used for saving window
- state.
- */
-
- /* ***** Menu Manager Stuff ***** */
-
- extern pascal void SetMenuItemEnable(MenuHandle menuH, SInt16 item, Boolean enable);
- /* Enable the item in the MenuHandle if enable is set, disable it otherwise.
- You've gotta wonder why this isn't in the operating system!
- */
-
- extern pascal Boolean FindMenuItem(MenuHandle menuH, Str255 itemTextToSearchFor,
- SInt16 *indexOfItemFound);
- /* This routine searches through the Menu Handle looking for
- itemTextToSearchFor. If it finds it, it returns true and sets
- indexOfItemFound to the position of the matching menu item.
- */
-
- /* ***** List Manager Stuff ***** */
-
- /* All of these List Manager routines are really targetted at one dimensional
- vertical lists. They don't work well for two dimensional or horizontal
- lists.
- */
-
- extern pascal void InitListManagerMiscSubs(void);
- /* The LDoKey function requires a bunch of global state to implement
- it's "select by typing" function. This routine initialises that
- information.
- */
-
- extern pascal void LSetNoSelection(ListHandle listH);
- /* This routine clears any selection in the list. */
-
- extern pascal LSelectAll(ListHandle listH);
- /* This routine selects the entire contents of the list. */
-
- extern pascal void LSetSingleSelection(ListHandle listH, SInt16 row);
- /* This routine selects the single cell (0, row) in the list. */
-
- /* The LDoKey routine takes a procedural parameter that is uses to fetch
- the text associated with an item in the list so that it can implement
- its "select by typing" function.
- */
-
- typedef pascal void (*GetListCellTextProcType)(ListHandle listH, Cell listCell, Str255 cellText);
-
- extern pascal void LDoKey(ListHandle listH, EventRecord *event, GetListCellTextProcType getCellText);
- /* This routine processes a key event associated with a list, including
- "select by typing". You can disable this function by passing nil to
- getCellText.
- */
-
- extern pascal SInt16 LSelectedLine(ListHandle lh);
- /* This function returns the vertical position of the first selected
- cell in the list, or -1 if there is no selected cell.
- */
-
- extern pascal Boolean LIsEmpty (ListHandle lh);
- /* This function returns true if the list is empty. */
-
- /* ***** Truly Misc Stuff ***** */
-
- extern pascal OSStatus AEGotRequiredParams(const AppleEvent *theAppleEvent);
- /* Returns no error if you've extracted all of the required
- parameters out of the AppleEvent.
- */
-